package com.anda.logistics.map.util;


import java.io.InputStream;

public class StreamUtil {
	
	public static String getString(InputStream is, String charset) {
		StringBuilder str = new StringBuilder();
		int temp = 0;
		byte[] b = new byte[102400];
		try {
			while ((temp = is.read(b, 0, b.length)) != -1) {
				str.append(new String(b, 0, temp, charset));
			}
			is.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return str.toString();
	}
	
	public static String getString(InputStream is) {
		StringBuilder str = new StringBuilder();
		int temp = 0;
		byte[] b = new byte[102400];
		try {
			while ((temp = is.read(b, 0, b.length)) != -1) {
				str.append(new String(b, 0, temp));
			}
			is.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return str.toString();
	}
}
